<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>验证用户名和密码</title>
</head>
<body>
    <script>
        var userName = prompt("请输入用户名");
        var passWord = prompt("请输入密码");
        while( userName!="admin" || passWord!="123456" ){
           alert("用户名或者密码有误");
           userName = prompt("请输入用户名");
           passWord = prompt("请输入密码");
        }
        alert("登录成功");
    </script>
</body>
</html>

<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>验证用户名和密码</title>
</head>
<body>
    <script>
        do {
            var userName = prompt("请输入用户名");
            var passWord = prompt("请输入密码");
        }while(userName!="admin"||passWord!="123456")
        alert("登录成功");
    </script>
</body>
</html>